% responses are the neural responses to stimuli
% spike counts or mfr.
function s = sparseness( responses, maxresponse )

responses = responses*(1/maxresponse);
% lifetime sparseness is over images.
s = 1- (sum(responses./length(responses)).^2)/(sum(responses.^2)/length(responses));
